#!/usr/bin/env bash
# vim: fdm=marker fmr=[[[,]]] cms=\ #%s#

main()
{
    local bin_path=$(dirname $0)
    if [ ${bin_path:0:1} != '/' ]
    then
        bin_path=$(pwd)/$bin_path
    fi
    cd $bin_path
    PATH=.:$PATH

    local program=svcnode
    local soar_libdir=../common/java/lib
    export CLASSPATH=${program}.jar:${soar_libdir}/soar.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/commons-beanutils.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/commons-collections.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/commons-lang.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/commons-logging.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/ezmorph.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/jdom.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/json-lib.jar
    CLASSPATH=$CLASSPATH:${soar_libdir}/xerces.jar
    java ${program}.Server &
}

main $@
exit $?
